package com.cube.saintaugustin.common;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class StoreManagerBroadcastReceiver extends BroadcastReceiver {

    private static KeepLoginListener keepLoginListener;

    public interface KeepLoginListener {
        public void keepLogin(boolean isKeepLogin);
    }

    public static void setKeepLoginListener(KeepLoginListener listener) {
        StoreManagerBroadcastReceiver.keepLoginListener = listener;
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();

        if (action.equals(CommonValues.ACTION_KEEP_LOGIN)) {
            boolean isKeepLogin = intent.getBooleanExtra("isKeepLogin", false);
            keepLoginListener.keepLogin(isKeepLogin);
        }
    }

}
